home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
misc
/
football
/
user
/
viewteamschedule.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1999-11-29
|
10KB
|
335 lines
/* Mode=Set */
/* ***********************************************************************
VIEW TEAM SCHEDULE PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 150997 First release.
151297 Tidied display.
210499 Added check for no team specified.
250899 Added error msg for file checks.
141099 Doh! Forgot to localise this script.....
Converted to use locale. Some error messages, before
reading the locale, will still be in English.
**************************************************************************
Procedure
---------
1. Check files exist. Read Teams.df datafile and store teams.
2. If league has not been autoscheduled then give an error and quit.
3. Search for specified team and if not found, give an error and quit.
4. Open Teams.sf datafile.
5. If "Week" or "Date" is found, grab the data and format it for later.
6. Use selected team against either HOME or AWAY team and if a match that
has yet to be played is found, display the data.
7. When the file is finished, print the number of matches and exit...
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.df'
input2_file = '.sf'
title = '*LEAGUE_NAME='
autosched = '*AUTOSCHD='
separator = '*'
teams. = '???'
counter = 0
not_played = '__ __'
months = "January February March April May June July August September October November December"
parse var league_stuff league_file search_team
league_file = "Data/" || league_file
addlib('rexxsupport.library',0,-30,0)
if open(datafile,"Data/Football.locale",'r') then do
line = readln(datafile)
locdir = strip(line)
close(datafile)
end
else do
say
say "ERROR : (ViewTeamSchedule)"
say
say "Cannot read 'Data/Football.locale' for the locale settings."
exit
end
dfordir = locdir"Football.locale_data"
locdir = locdir"User/ViewTeamSchedule.data"
if open(datafile,"ENV:FootballRXPath",'r') then do
line = readln(datafile)
rxdir = strip(line)
close(datafile)
end
else
rxdir = "SYS:Rexxc/"
if exists(locdir) > 0 then do
address command rxdir'rx 'locdir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
else do
say
say "ERROR : (ViewTeamSchedule)"
say
say "Cannot find '"locdir"' to read locale settings."
exit
end
if exists(dfordir) > 0 then do
address command rxdir'rx 'dfordir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
else do
say
say "ERROR : (ViewTeamSchedule)"
say
say "Cannot find '"dfordir"' to read date locale settings."
exit
end
if exists(league_file || input_file) = 0 then do
say
say vts_error
say
say vts_1"'"league_file || input_file"'."
exit
end
if exists(league_file || input2_file) = 0 then do
say
say vts_error
say
say vts_1"'"league_file || input2_file"'."
exit
end
if search_team = "" then do
say
say vts_error
say
say vts_4
say
say vts_5" "vts_9
say
exit
end
autos = 0
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(title,line) > 0 then
league_title = delstr(line,1,13)
if pos(autosched,line) > 0 then do
autofile = delstr(line,1,10)
autos = 1
end
if pos(separator,line) = 0 then do
line = strip(line)
if counter = 0 then do
teams.1 = line
counter = 1
end
else do
counter = counter + 1
teams.counter = line
end
end
end
close(datafile)
end
else do
say
say vts_error
say
say vts_2"'"league_file||input_file"'"vts_3
exit
end
if autos = 0 then do
say
say vts_error
say
say vts_6" '"search_team"'."
say
say vts_7
say vts_8
say "'Teams6.schd'. "vts_9
say
exit
end
sel=-1
search_team = strip(search_team)
do i=1 to counter
if pos(search_team,teams.i) > 0 then
sel = i
end
if sel > 0 then do
say
say center(vts_10" '"league_title"'",78)
say "-------------------------------------------------------------------------------"
say
say vts_11" '"autofile"' "vts_12
say
say
say vts_13": "teams.sel
say
say vts_14
say "----------------------------------------------------"
say
matches = 0
s_l = 0
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(separator,line) > 0 then do
if pos("*Week:",line) > 0 then do
curr = subword(line,2)
end
if pos("*Date:",line) > 0 then do
if s_l = 0 then do
parse var line "*Date:" dateall
search_loc = strip(word(dateall,words(dateall)-1))
do mnls=1 to 12
if pos(word(months,mnls),search_loc) > 0 then do
s_l = 1
leave
end
end
if s_l = 0 then do
locale_cats = showdir("Locale/")
do search_locale=1 to words(locale_cats)
dfordir = "Locale/"word(locale_cats,search_locale)"/Football.locale_data"
if exists(dfordir) > 0 then do
address command rxdir'rx 'dfordir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
parse var line "*Date:" dateall
search_loc = strip(word(dateall,words(dateall)-1))
do mnls=1 to 12
if pos(word(months,mnls),search_loc) > 0 then do
s_l = 1
leave
end
end
if s_l = 1 then leave
end
end
if s_l > 0 then do
temp_dtal = dateall
parse var date_format "day" sp1 "number" sp2 "month" sp3 "year"
parse var line "*Date:" dateall
do i=1 to 7
if pos(word(days,i),dateall) > 0 then do
lk = pos(word(days,i),dateall)
dateall = delstr(dateall,1,lk+length(word(days,i))+length(sp1)-1)
end
end
dateall = strip(dateall)
year = word(dateall,words(dateall))
mnth = strip(word(dateall,words(dateall)-1))
do lm=1 to length(mnth)
if datatype(substr(mnth,1,1),'m') ~= 1 then
mnth = delstr(mnth,1,1)
end
dateall = temp_dtal
day = word(dateall,2)
do lm=1 to length(day)-2
if datatype(substr(day,3,1),'n') ~= 1 then
day = delstr(day,3,1)
end
cv = 0
do i=1 to 12
if pos(word(months,i),mnth) > 0 then do
cv = i
leave
end
end
end
if s_l = 0 then do
say
say vts_error
say
say vts_21
exit
end
curr = right(day,2,0)" "substr(word(months,cv),1,3)" "substr(year,3,2)
s_l = 0
end
end
/*
if pos("*Date:",line) > 0 then do
year = word(line,5)
mnth = word(line,4)
day = word(line,3)
curr = right(day,2,0)" "substr(mnth,1,3)" "substr(year,3,2)
end
*/
end
if pos(separator,line) = 0 then do
if pos(not_played,line) > 0 then do
home_team = strip(substr(line,1,30))
away_team = strip(substr(line,41,30))
strng = strip(teams.sel)
if strng = home_team then do
say left(curr,12)""left(vts_15,9,' ')""left(away_team,30)
matches = matches + 1
end
if strng = away_team then do
say left(curr,12)""left(vts_16,9,' ')""left(home_team,30)
matches = matches + 1
end
end
end
end
close(datafile)
say
if matches = 0 then
say vts_17
else
say vts_18": "matches
say
say "-------------------------------------------------------------------------------"
say
end
else do
say
say vts_error
say
say vts_2"'"league_file || input2_file"'"vts_3
exit
end
end
else do
say
say vts_error
say
say vts_19" '"search_team"' "vts_20
end
exit